var form,$,table,layer;
var user = JSON.parse(localStorage.getItem('user'));
layui.use(['form','jquery','table','layer'],function() {
    form = layui.form;
    $ = layui.$;
    table = layui.table;
    layer = layui.layer;

    getToExamineMessages();
});

function getToExamineMessages(){
    var microcircleId = $('#proId',window.parent.document).val();
    $.ajax({
        url:'/toExamine/getToExamineMicroCircleById',
        dataType:'json',
        data:{"microcircleId": microcircleId},
        success:function (data) {
            data = data.data;
            $('input[name = serialNumber]').val(data.serialNumber);
            $('input[name = artcleTitle]').val(data.artcleTitle);
            $('input[name = categroyName]').val(data.artcleCategroyName);
            $('input[name = artcleKeywords]').val(data.artcleKeywords);
            if(data.result == 1){
                data.result = "审核通过";
            }else if(data.result == 2){
                data.result = "未审核";
            }else if(data.result == 3){
                data.result = "审核驳回";
            }
            $('input[name = result]').val(data.result);
            $('input[name = acticleHits]').val(data.acticleHits);
            $('input[name = acticleLike]').val(data.acticleLike);
            $('input[name = acticleReviews]').val(data.acticleReviews);
            $('input[name = acticleShare]').val(data.acticleShare);
            article = data.article;
            var articleStart = article.indexOf("<img");
            var articleEnd = article.lastIndexOf(">");
            if (articleStart != 0 && articleEnd == article.length - 1){
                article = article.substring(0,articleStart);
            }else if (articleStart == 0){
                console.log(article);
                article = article.substring(articleEnd + 1,article.length);
            }else{
                article = article.substring(0,articleStart) + article.substring(articleEnd + 1,article.length);
            }
            $('#article').val(article);
            if (data.artcleUrl != ''){
                $('#artcleUrl').html('<img src='+data.artcleUrl+' style="float:left; width:155px;"/>');
            }
        }
    });
}